#! /usr/bin/python3
# _*_ coding:UTF-8 _*_
"""
    偏函数
"""
import functools


def test():
    i = int('12345')
    print(i)
    i_10 = int('12345', base=10)
    i_8 = int('12345', base=8)
    i_16 = int('12345', base=16)
    i_2 = int('10000000', base=2)
    print('i_10:{}\ni_8:{}\ni_16:{}\ni_2:{}'.format(i_10, i_8, i_16, i_2))

    def int2(x, base=2):
        return int(x, base)

    i_2 = int2('10000000')
    print('i_2:%d' % i_2)
    int3 = functools.partial(int, base=2)
    i_2 = int3('10000000')
    print('partial::i_2:%d' % i_2)


if __name__ == '__main__':
    test()
